"""
-*- coding: utf-8 -*-
@Time : 2021/10/5 17:08
@Author : chenke
@File : common_fun.py
"""
import time,os
from common.base import BasePage


class Common_fun(BasePage):

    def getTime(self):
        self.now = time.strftime("%Y-%m-%D %H_%M_%S")
        return self.now

    def getScreenshots(self, module):
        '''
        获取屏幕截图并保存
        :param module:
        :return:
        '''
        #__file__当前文件的目录
        image_file = os.path.dirname(os.path.dirname(__file__))+"/screenshots/%s_%s.png"%(module,self.getTime())
        self.driver.get_screenshot_as_file(image_file)